﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfProgram.Controls
{
    /// <summary>
    /// WindowTextBox.xaml 的交互逻辑
    /// </summary>
    public partial class WindowTextBox : Window
    {
        public WindowTextBox()
        {
            InitializeComponent();
        }

        //输入框内容变化事件
        private void f1(object sender, TextChangedEventArgs e)
        {
            //this.t1.Text; 获取输入框文本内容属性 字符串属性
            this.l1.Content = this.t1.Text;
        }

        // 按钮点击事件
        private void f2(object sender, RoutedEventArgs e)
        {
            //SelectedText; 选中部分内容
            // 把选中部分内容显示lable上
            // this.l1.Content = this.t1.SelectedText;

            // SelectionStart获取选中文本起始索引
            this.l1.Content = this.t1.SelectionStart.ToString();
        }
    }
}
